/**
 * 节流处理重复点击
 * @param func 函数
 * @param delay 多久内只执行一次 单位:毫秒
 * @returns 
 */
export function throttle(func: Function, delay: number = 1000) {
    let lastCall = 0;
    return function (...args: any) {
        const now = new Date().getTime();
        if (now - lastCall < delay) return;
        lastCall = now;
        return func(...args);
    }
}

export const UUID = (): string => {
    function S4() {
        return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
    }
    return (S4() + S4() + new Date().getTime() + S4()).toUpperCase();
}